package com.testing.sunnyserver;

import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import sun.misc.Unsafe;

import java.lang.reflect.Field;

/**
 * @Classname SunnyClientAppliaction
 * @Description 类型说明
 * @Date 2023/7/12 13:33
 * @Created by 特斯汀Roy
 */
@SpringBootApplication
@MapperScan("com.testing.sunnycommon.mapper")
@ComponentScan(basePackages = {"com.testing.sunnycommon", "com.testing.sunnyserver"})
@EnableDubbo
public class SunnyServerApplication {

    public static void main(String[] args) {
        try {
            Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
            unsafe.setAccessible(true);
            Unsafe unsafeInstance = (Unsafe) unsafe.get(null);

            Class clazz = Class.forName("jdk.internal.module.IllegalAccessLogger");
            Field logger = clazz.getDeclaredField("logger");
            unsafeInstance.putObjectVolatile(clazz, unsafeInstance.staticFieldOffset(logger), null);
        } catch (Exception e) {
        }
        SpringApplication.run(SunnyServerApplication.class, args);
    }
}
